/**
 *  Copyright (C) 2006 zhangbo (freeeob@gmail.com)
 *
 *  This product is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation; either version 2.1 of the License, or
 *  (at your option) any later version.
 * 
 *  This product is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 * 
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 *
 *  author:zhangbo
 *  Email:jsjava@gmail.com
 */

/**
 * constructor
 * @param legend the border display title
 * @param content the inner content
 * @param borderClass the border css class
 * @param legendClass the legend css class
 */ 
function TitledBorder(legend,content,borderClass,legendClass,legendAlign){
	this.jsjava_class="jsorg.eob.component.border.TitledBorder";
	this.legend=legend;
	if(legend==undefined){
		this.legend="";
	}
	this.content=content;
	this.borderClass=borderClass;
	this.legendClass=legendClass;
	this.legendAlign=legendAlign;
}

TitledBorder.LEFT_ALIGNMENT="left";
TitledBorder.CENTER_ALIGNMENT="center";
TitledBorder.RIGHT_ALIGNMENT="right";

/**
 * Set the border display title
 * @param legend the border display title 
 */
TitledBorder.prototype.setLegend=function(legend){
	this.legend=legend;
};

/**
 * Set the border display inner HTML
 * @param content the border display inner HTML 
 */
TitledBorder.prototype.setContent=function(content){
	this.content=content;
};

/**
 * Set the border css class
 * @param borderClass 
 */
TitledBorder.prototype.setBorderClass=function(borderClass){
	this.borderClass=borderClass;
};

/**
 * Set the legend css class
 * @param legendClass 
 */
TitledBorder.prototype.setLegendClass=function(legendClass){
	this.legendClass=legendClass;
};

/**
 * Set the legend css class
 * @param legendClass 
 */
TitledBorder.prototype.setLegendAlignment=function(legendAlign){
	this.legendAlign=legendAlign;
};

/**
 * Return the html string of the component
 */
TitledBorder.prototype.toHTML=function(){
	var html="<fieldset class='"+this.borderClass+"'><legend class='"+this.legendClass+"' align='"+this.legendAlign+"'>"+this.legend+"</legend>"+this.content+"</fieldset>";
	return html;
};